package com.niit.web.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.niit.bean.Classify;
import com.niit.service.ClassifyService;
import com.niit.service.impl.ClassifyServiceImpl;
import com.niit.utils.WebKit;

@WebServlet("/AddClassifyController")
public class AddClassifyController extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
  
  
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		Classify classify = WebKit.request2Bean(request, Classify.class);
		ClassifyService cs = new ClassifyServiceImpl();
		int a = cs.add(classify);
		if(a>0){
			response.getOutputStream().write("添加成功".getBytes());
		}else{
			response.getOutputStream().write("添加失败".getBytes());
		}
	}

}
